import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { BaseAdminResult, BaseResult, BaseScrollPageListResult } from "@/common/base/base.result";
import {
  BooleanNumber,
  EvaluationCategory,
  EvaluationProjectType, EvaluationStatus
} from "common/utils/data";

export class EvaluationBrand {
  @ApiProperty()
  title: string

  @ApiProperty()
  img: string
}


class EvaluationBatchResultDatas {
  @ApiProperty({
    description: '解析后的内容',
    type: 'array',
    items: {
      type: 'array',
      items: {
        type: 'string',
      },
    },
  })
  dataSet: string[][];

  @ApiProperty({
    description: '描述',
  })
  desc: string;

  @ApiProperty({
    description: '图片',
  })
  img: string;

  @ApiProperty()
  name: string;

  @ApiProperty()
  defaultShow: BooleanNumber;

  @ApiProperty({
    description: 'json数据',
  })
  json: any;
}
class EvaluationBatchResultProject extends BaseResult{
  @ApiProperty()
  name: string;

  @ApiProperty()
  rule: object;

  @ApiProperty()
  desc: string;

  @ApiProperty({
    enum: EvaluationProjectType
  })
  type: EvaluationProjectType;
}
export class EvaluationBatchResultListItem{
  @ApiProperty({
    type: [EvaluationBatchResultDatas],
  })
  datas: EvaluationBatchResultDatas[];

  @ApiProperty()
  title: string;
}

export class EvaluationBatchResult{
  @ApiProperty({
    type: [EvaluationBatchResultListItem]
  })
  list: EvaluationBatchResultListItem[];

  @ApiProperty()
  project: EvaluationBatchResultProject;
}

export class EvaluationIndexResultSpecification extends BaseResult{
  @ApiProperty()
  value: string

  @ApiProperty()
  specificationUuid: string;

}
export class EvaluationIndexResultBrand extends EvaluationBrand{
}

export class EvaluationIndexResultArticle {
  @ApiProperty()
  desc: string

  @ApiProperty()
  keywords: string[]

  @ApiProperty()
  publishTime: number

  @ApiProperty()
  thumbnails: string[]
}

export class EvaluationIndexResult extends BaseScrollPageListResult{
  @ApiProperty()
  title: string;

  @ApiProperty()
  category: EvaluationCategory;

  @ApiProperty()
  dataGroups?: string[];

  @ApiProperty()
  article: EvaluationIndexResultArticle;

  @ApiProperty({
    type: [EvaluationIndexResultSpecification]
  })
  specifications: EvaluationIndexResultSpecification[];

  @ApiProperty()
  brand: EvaluationIndexResultBrand

  @ApiPropertyOptional()
  price?:number

  @ApiProperty()
  buyUrl:string
}

class EvaluationProject extends BaseResult{
  @ApiProperty({
    description: '名称',
  })
  name: string;

  @ApiProperty({
    description: '描述',
  })
  desc: string;

  @ApiProperty({
    description: '类型',
    enum: EvaluationProjectType,
  })
  type: EvaluationProjectType;

  @ApiProperty({
    description: '描述',
  })
  rule: object;
}

class EvaluationDataItemBase{
  @ApiProperty({
    description: '图片',
  })
  img: string;

  @ApiProperty({
    description: 'json数据',
  })
  json: any;

  @ApiProperty({
    description: '描述',
  })
  desc: string;

  @ApiProperty({
    description: '名称',
  })
  name: string;

  @ApiProperty()
  group: string;

  @ApiProperty()
  defaultShow: BooleanNumber;
}

class EvaluationItemChildren extends EvaluationDataItemBase{
  @ApiProperty({
    description: '解析后的内容',
    type: 'array',
    items: {
      type: 'array',
      items: {
        type: 'string',
      },
    },
  })
  dataSet: string[][];
}

export class EvaluationData extends BaseResult{
  @ApiProperty({
    type: [EvaluationItemChildren]
  })
  children: EvaluationItemChildren[]

  @ApiProperty({
    description: '类型',
  })
  project: EvaluationProject;

  @ApiProperty({
    description: '类型uuid',
  })
  projectUuid: string
}

export class EvaluationShowResult extends BaseResult{
  @ApiProperty()
  title: string;

  @ApiProperty()
  category: EvaluationCategory;

  @ApiProperty()
  dataGroups?: string[];

  @ApiProperty()
  article: EvaluationIndexResultArticle;

  @ApiProperty({
    type: [EvaluationIndexResultSpecification]
  })
  specifications: EvaluationIndexResultSpecification[];

  @ApiProperty()
  brand: EvaluationIndexResultBrand

  @ApiPropertyOptional()
  price?:number

  @ApiProperty()
  buyUrl:string

  @ApiProperty({
    type: [EvaluationData]
  })
  datas: EvaluationData[]
}

export class EvaluationBatchTitleResult extends BaseResult{
  @ApiProperty()
  title: string

  @ApiProperty()
  belong: string
}


export class EvaluationAdminIndexResultArticle {
  @ApiProperty()
  desc: string

  @ApiProperty()
  keywords: string[]

  @ApiProperty()
  publishTime: number

  @ApiProperty()
  thumbnails: string[]

  @ApiProperty()
  isStick: BooleanNumber
}

export class EvaluationAdminIndexResult extends BaseAdminResult {
  @ApiProperty()
  article: EvaluationAdminIndexResultArticle;

  @ApiProperty()
  title: string;

  @ApiProperty()
  status: EvaluationStatus;

  @ApiProperty()
  category: EvaluationCategory;

  @ApiProperty()
  brand: EvaluationBrand;
}

class EvaluationAdminItemChildren extends EvaluationDataItemBase{
  @ApiProperty()
  data: string;

  @ApiProperty()
  project: EvaluationProject;

  @ApiProperty()
  projectUuid: string
}


class EvaluationAdminShowResultSpecificationItem extends BaseResult{
  @ApiProperty()
  specificationUuid: string;

  @ApiProperty()
  value: string;
}

class EvaluationAdminShowResultImpulseResponseFileItem extends BaseResult{
  @ApiProperty()
  url: string;

  @ApiPropertyOptional()
  group?: string;
}

export class EvaluationAdminShowResult extends EvaluationAdminIndexResult {
  @ApiProperty()
  brandUuid: string

  @ApiProperty({
    type: [EvaluationAdminItemChildren]
  })
  datas: EvaluationAdminItemChildren[];

  @ApiProperty({
    type: [EvaluationData]
  })
  showDatas: EvaluationData[]

  @ApiPropertyOptional()
  buyUrl?: string;

  @ApiProperty()
  dataGroups: string[];

  @ApiPropertyOptional()
  price?: number;

  @ApiProperty({
    type: [EvaluationAdminShowResultSpecificationItem]
  })
  specifications: EvaluationAdminShowResultSpecificationItem[];

  @ApiProperty({
    type: [EvaluationAdminShowResultImpulseResponseFileItem]
  })
  impulseResponseFiles: EvaluationAdminShowResultImpulseResponseFileItem[];
}

export class EvaluationOpenapiIndexResult extends EvaluationIndexResult{
}